package com.cskaoyan.shopping.converter;

import com.cskaoyan.mall.dto.ItemDto;
import com.cskaoyan.mall.dto.ProductDto;
import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.entitys.Panel;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.entitys.PanelContentItem;
import com.cskaoyan.shopping.dto.CcProductDetailDto;
import com.cskaoyan.shopping.dto.PanelContentItemDto;
import com.cskaoyan.shopping.dto.PanelDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @auther cskaoyan
 * @date 2022/8/24:14:36
 */
@Mapper(componentModel = "spring")
public interface CcProductConverter {

    // aItem  -> c ProductDetailDto
    @Mapping(source = "title", target = "productName")
    // @Mapping(source = "image", target = "productImageSmall")
    @Mapping(source = "id",target = "productId")
    @Mapping(source = "price",target = "salePrice")
    @Mapping(source = "sell_point",target = "subTitle")
    @Mapping(source = "limit_num",target = "limitNum")
    CcProductDetailDto productDoToDto(Item item);


    PanelDto panelTOPanelDto(Panel panel);


    @Mapping(source = "title", target = "productName")
    @Mapping(source = "id",target = "productId")
    @Mapping(source = "sell_point",target = "subTitle")
    @Mapping(source = "price",target = "salePrice")
    ProductDto itemToProductDTO(Item item);


    List<ProductDto> itemsToProductDtos(List<Item> items);

    PanelContentItemDto PanelContentToDto(PanelContentItem panelContentItem);

    List<PanelContentItemDto>  PanelContentsToDtos(List<PanelContentItem> panelContentItems);

}
